/*
 *      Okulov Rostislav, 2011
 *      
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;


public class le_engine {

	public void le_OrthoMode(int left, int top, int right, int bottom, GLAutoDrawable drawable) {
		final GL gl = drawable.getGL();
		gl.glMatrixMode(GL.GL_PROJECTION);
	    gl.glPushMatrix();
	    gl.glLoadIdentity();
	    gl.glOrtho( left, right, bottom, top, 0, 1 );
	    gl.glMatrixMode(GL.GL_MODELVIEW);
	    gl.glLoadIdentity();
	    gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
	}

	public void le_PerspectiveMode(GLAutoDrawable drawable) {
		final GL gl = drawable.getGL();
	    gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
	    gl.glMatrixMode( GL.GL_PROJECTION );
	    gl.glPopMatrix();
	    gl.glMatrixMode( GL.GL_MODELVIEW );
	}
}
